$OpenBSD: patch-Makefile,v 1.2 2008/06/09 04:47:59 naddy Exp $
--- Makefile.orig	Sun Oct 12 11:16:12 2003
+++ Makefile	Sun Jun  8 22:45:16 2008
@@ -2,7 +2,7 @@
 # http://tech.motion-twin.com
 .SUFFIXES : .ml .mli .cmo .cmx .cmi .mll .mly
 
-INSTALLDIR=`ocamlc -where`
+INSTALLDIR=$(DESTDIR)/`ocamlc -where`
 CFLAGS=
 LFLAGS= -a
 LIBS=
@@ -11,9 +11,13 @@ all: xml-light.cma test.exe doc
 
 opt: xml-light.cmxa test_opt.exe
 
-install: all opt
-	cp xml-light.cmxa xml-light.a xml-light.cma xml.mli xmlParser.mli dtd.mli xml.cmi xmlParser.cmi dtd.cmi xml.cmx dtd.cmx xmlParser.cmx $(INSTALLDIR)
-
+install: all
+	mkdir -p $(INSTALLDIR)
+	cp xml-light.cma xml.mli xmlParser.mli dtd.mli xml.cmi xmlParser.cmi dtd.cmi $(INSTALLDIR)
+
+installopt: opt
+	cp xml-light.a xml-light.cmxa xml.cmx dtd.cmx xmlParser.cmx $(INSTALLDIR)
+
 doc:
 	mkdir doc
 	ocamldoc -sort -html -d doc xml.mli dtd.mli xmlParser.mli
@@ -53,6 +57,8 @@ xml_lexer.cmi: dtd.cmi
 xml_parser.cmo: xml_parser.ml dtd.cmi xml_parser.mli xml_parser.cmi
 
 xml_parser.cmx: xml_parser.ml dtd.cmi xml_parser.mli xml_parser.cmi
+
+xml_parser.cmi: xml_parser.mli dtd.cmi xml.cmi
 
 xml_lexer.cmo: xml_lexer.ml xml_lexer.cmi
 
